package ar.com.tallerdos.smartdinner.business;

import java.util.List;

import ar.com.tallerdos.smartdinner.dao.SubrubroDao;
import ar.com.tallerdos.smartdinner.model.Subrubro;

public class SubrubroBusiness {
    private static SubrubroDao dao;
    
    public static Subrubro findById(Integer id) {
	return getDao().findById(id);
    }
    
    public static List<Subrubro> findAll() {
	return getDao().findAll();
    }
    
    public static void create(Subrubro entity) {
	getDao().create(entity);
    }
    
    public static Boolean delete(Subrubro entity) {
	return delete(entity.getId());
    }
    
    public static Boolean delete(Integer id) {
	return getDao().delete(id);
    }
    
    public static Boolean update(Subrubro entity) {
	return getDao().update(entity);
    }
    
    public static Boolean createOrUpdate(Subrubro entity) {
	return getDao().createOrUpdate(entity);
    }

    public static SubrubroDao getDao() {
	if (dao == null) {
	    dao = new SubrubroDao();
	}
        return dao;
    }

    public static void setDao(SubrubroDao dao) {
	SubrubroBusiness.dao = dao;
    }
}
